package com.lglbc.protype.deep;

import java.io.Serializable;
/**
 * @author： 乐哥聊编程(全平台同号)
 */
public class Student implements Cloneable, Serializable {
    private String name;
    private String email;
    private String address;
    private Teacher teacher;

    public Student(String name, String email, String address) {
        this.name = name;
        this.email = email;
        this.address = address;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    @Override
    protected Student clone() {
        try {
            Student clone = (Student) super.clone();
            Teacher teacher = clone.getTeacher().clone();
            clone.setTeacher(teacher);
            return clone;
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", email='" + email + '\'' +
                ", address='" + address + '\'' +
                ", teacher=" + teacher +
                '}';
    }

    public Teacher getTeacher() {
        return teacher;
    }

    public void setTeacher(Teacher teacher) {
        this.teacher = teacher;
    }
}
